import matplotlib.pyplot as plt
import numpy as np

plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False

x = np.arange(0, 10, 0.1)
y1 = np.sin(x)
y2 = np.cos(x)

plt.figure(figsize=(10, 6))
plt.fill_between(x, 0, y1, alpha=0.5, label='sin(x)')
plt.fill_between(x, y1, y1 + y2, color = '#0FF', alpha=0.5, label='cos(x)')

plt.title('堆叠面积图示例')
plt.grid(True, linestyle='--', alpha=0.5)
plt.ylabel('Y轴')
plt.xlabel('X轴')
plt.legend()
plt.show()
